/**
 * Copyright 2002 Cordys R&D B.V. 
 * 
 * This file is part of the Cordys .NET Connector. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 /********************************************************************
			Declaration of Document Class
********************************************************************/
#include "Managed.h"
#include "Document.h"

namespace com
{
  namespace eibus
	{
	namespace xml
		{
		namespace nom
			{

				public __gc class Node
					{
					private : 

						static  Document* doc_ref = NULL;
						static const  Int32 WRITE_NORMAL = 0;
						static const  Int32 WRITE_PRETTY = 1;

					//Not to allow to create the object of this type
					private : Node(){};					

					public :						
						static Int32 Add(Int32 node, Int32 dest_element);
						static Int32 Add(Int32 fromNode, Int32 toNode ,Int32 dest_element);							
						static Int32 Append(Int32 node, Int32 dest_element);
						static Int32 Append(Int32 fromNode, Int32 toNode, Int32 dest_element);
						static Int32 AppendToChild(Int32 node, Int32 dest_element);
						static Int32 AppendToChild(Int32 fromNode, Int32 toNode, Int32 dest_element);
						static Int32 Delete(Int32 node);
						static Int32 Delete(Int32 fromNode, Int32 toNode );
						static Int32 Duplicate(Int32 node);
						static Int32 Duplicate(Int32 fromNode, Int32 toNode );
						static Int32 DuplicateAndAdd(Int32 fromNode, Int32 toNode , Int32 dest_element );
						static Int32 DuplicateAndAppend(Int32 fromNode, Int32 toNode , Int32 dest_element );
						static Int32 DuplicateAndAppendToChildren(Int32 fromNode, Int32 toNode , Int32 dest_element);
						static Int32 DuplicateAndInsert(Int32 fromNode, Int32 toNode , Int32 dest_element );
						static Int32 DuplicateAndInsertinChildren(Int32 fromNode, Int32 toNode , Int32 dest_element );
						static String* GetAttribute(int node, String* name);
						static String* GetAttribute(int node, String* name , String __gc * defaultValue);
						static String* GetAttributeName(Int32 node , Int32 index);
						static String* GetAttributeNameSpaceURI(Int32 node , Int32 index);
						static String* GetAttributePrefix(Int32 node , Int32 index);
						static Int32 GetCompoundType(int node);
						static String* GetData(int node);
						static String* GetData(int node, String __gc * defaultValue);
						static String* GetDataElement(Int32 node, String* tagName, String __gc * defaultValue);
						static String* GetDataElementNS(Int32 node, String* tagName, String* uri, String __gc * defaultValue);	// New for BP
						//static String __gc * GetDataOfFirstChildElement(); 

						//This should return the data type of DataType type ..
						//Check it up.
						static Int32 GetDataType(Int32 node);
						static Document* GetDocument(Int32 node);
						static Int32 GetElement(Int32 node, String* tagName);	// this can be used instead of Find.firtsMatch(fChild<tag>)
						static Int32 GetElementNS(Int32 node, String* tagName, String* uri);	// New for BP
						static Int32 GetFirstChild(Int32 node);
						static Int32 GetFirstChildElement(Int32 node);
						static Int32 GetFirstDataNode(Int32 node);
						static Int32 GetFirstElement(Int32 node);
						static Int32 GetLastChild(Int32 node);
						static Int32 GetLastChildElement(Int32 node);
						static String* GetLocalName(Int32 node);
						static String* GetName(Int32 node);
						static String* GetNameSpaceURI(Int32 node);
						static Int32 GetNextSibling(Int32 node);
						static Int32 GetNextElement(Int32 node);
						static Int32 GetNumAttributes(Int32 node);
						static Int32 GetNumChildren(Int32 node);
						static Int32 GetNumChildElements(Int32 node);
						static Int32 GetNumNextSiblings(Int32 node);
						static Int32 GetNumPreviousSiblings(Int32 node);
						static Int32 GetNumSiblings(Int32 node);
						static Int32 GetParent(Int32 node);
						static String* GetPrefix(Int32 node);
						static Int32 GetPreviousSibling(Int32 node);
						static Int32 GetPreviousElement(Int32 node);
						static Int32 GetRoot(Int32 node);
						static Int32 GetNodeType(Int32 node);
						static Int32 Insert(Int32 node, Int32 dest);
						static Int32 Insert(Int32 nodefrom, Int32 nodeto, Int32 dest);
						static Int32 InsertInChildren(Int32 nodefrom, Int32 nodeto, Int32 dest);
						static Int32 RemoveAttribute(Int32 nodefrom, String* tagName);
						static void SetAttribute(Int32 node,String* tagName ,String* tagValue);						
						static void SetData(Int32 node,String* data);
						static void SetDataElement(Int32 node,String* tagName, String* data);
						static void SetDocument(Document* doc);
						static void SetName(Int32 node, String* name);
						static void Unlink(Int32 node);
						static void Unlink(Int32 node, Int32 to);
						static Byte WriteToByteArray(Int32 node, bool pretty) __gc[];
						static Byte WriteToByteArray(Int32 fromNode ,Int32 toNode ,bool pretty) __gc[];
						static void WriteToFile(Int32 node,String* fileName ,bool pretty);						
						static void WriteToFile(Int32 fromNode,Int32 toNode ,String* fileName ,bool pretty);						
						static String* WriteToString(int node,bool pretty);

					};//end of Node class

			}//End of nom namespace
		}//End of xml namespace		
	}//End of eibus namespace
}//End of com namespace